package com.yazi.mxz.common.entity.beans;

import com.myframework.smhj.hibernate.Entity;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.SEQUENCE;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * Goods entity. @author MyEclipse Persistence Tools
 */
@javax.persistence.Entity
@Table(name = "MXZ_GOODS", schema = "MXZ", uniqueConstraints = @UniqueConstraint(columnNames = {
		"COMPANY_ID", "BAR_CODE" }))
public class Goods extends Entity implements java.io.Serializable {

	// Fields

	private Long goodsId;
	private Category category;
	private Company company;
	private GoodsClassify goodsClassify;
	private String barCode;
	private String name;
	private String title;
	private String keywords;
	private Float price;
	private Integer stockEnd;
	private String unit;
	private Float sellDef;
	private Float sellMin;
	private Float sellExt;
	private String sellUnit;
	private Float unitConvert;
	private String pic;
	private String descrText;
	private String descrDef;
	private Long addTime;
	private String subTitle;
	private String categoryPath;
	private String standard;
	private Set<SpecType> specTypes = new HashSet<SpecType>(0);
	private Set<StoreGoods> storeGoodses = new HashSet<StoreGoods>(0);

	// Constructors

	/** default constructor */
	public Goods() {
	}

	/** minimal constructor */
	public Goods(Category category, Company company,
			GoodsClassify goodsClassify, String barCode, String name,
			String title, Float price, Integer stockEnd, String unit,
			Float sellDef, Float sellMin, Float sellExt, Long addTime,
			String categoryPath) {
		this.category = category;
		this.company = company;
		this.goodsClassify = goodsClassify;
		this.barCode = barCode;
		this.name = name;
		this.title = title;
		this.price = price;
		this.stockEnd = stockEnd;
		this.unit = unit;
		this.sellDef = sellDef;
		this.sellMin = sellMin;
		this.sellExt = sellExt;
		this.addTime = addTime;
		this.categoryPath = categoryPath;
	}

	/** full constructor */
	public Goods(Category category, Company company,
			GoodsClassify goodsClassify, String barCode, String name,
			String title, String keywords, Float price, Integer stockEnd,
			String unit, Float sellDef, Float sellMin, Float sellExt,
			String sellUnit, Float unitConvert, String pic, String descrText,
			String descrDef, Long addTime, String subTitle,
			String categoryPath, String standard, Set<SpecType> specTypes,
			Set<StoreGoods> storeGoodses) {
		this.category = category;
		this.company = company;
		this.goodsClassify = goodsClassify;
		this.barCode = barCode;
		this.name = name;
		this.title = title;
		this.keywords = keywords;
		this.price = price;
		this.stockEnd = stockEnd;
		this.unit = unit;
		this.sellDef = sellDef;
		this.sellMin = sellMin;
		this.sellExt = sellExt;
		this.sellUnit = sellUnit;
		this.unitConvert = unitConvert;
		this.pic = pic;
		this.descrText = descrText;
		this.descrDef = descrDef;
		this.addTime = addTime;
		this.subTitle = subTitle;
		this.categoryPath = categoryPath;
		this.standard = standard;
		this.specTypes = specTypes;
		this.storeGoodses = storeGoodses;
	}

	// Property accessors
	@SequenceGenerator(name = "generator", sequenceName = "SEQ_GOODS")
	@Id
	@GeneratedValue(strategy = SEQUENCE, generator = "generator")
	@Column(name = "GOODS_ID", unique = true, nullable = false, precision = 15, scale = 0)
	public Long getGoodsId() {
		return this.goodsId;
	}

	public void setGoodsId(Long goodsId) {
		this.goodsId = goodsId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "CAT_ID", nullable = false)
	public Category getCategory() {
		return this.category;
	}

	public void setCategory(Category category) {
		this.category = category;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "COMPANY_ID", nullable = false)
	public Company getCompany() {
		return this.company;
	}

	public void setCompany(Company company) {
		this.company = company;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "CLASSIFY_ID", nullable = false)
	public GoodsClassify getGoodsClassify() {
		return this.goodsClassify;
	}

	public void setGoodsClassify(GoodsClassify goodsClassify) {
		this.goodsClassify = goodsClassify;
	}

	@Column(name = "BAR_CODE", nullable = false, length = 20)
	public String getBarCode() {
		return this.barCode;
	}

	public void setBarCode(String barCode) {
		this.barCode = barCode;
	}

	@Column(name = "NAME", nullable = false, length = 250)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "TITLE", nullable = false, length = 250)
	public String getTitle() {
		return this.title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	@Column(name = "KEYWORDS", length = 150)
	public String getKeywords() {
		return this.keywords;
	}

	public void setKeywords(String keywords) {
		this.keywords = keywords;
	}

	@Column(name = "PRICE", nullable = false, precision = 8)
	public Float getPrice() {
		return this.price;
	}

	public void setPrice(Float price) {
		this.price = price;
	}

	@Column(name = "STOCK_END", nullable = false, precision = 8, scale = 0)
	public Integer getStockEnd() {
		return this.stockEnd;
	}

	public void setStockEnd(Integer stockEnd) {
		this.stockEnd = stockEnd;
	}

	@Column(name = "UNIT", nullable = false, length = 30)
	public String getUnit() {
		return this.unit;
	}

	public void setUnit(String unit) {
		this.unit = unit;
	}

	@Column(name = "SELL_DEF", nullable = false, precision = 8, scale = 1)
	public Float getSellDef() {
		return this.sellDef;
	}

	public void setSellDef(Float sellDef) {
		this.sellDef = sellDef;
	}

	@Column(name = "SELL_MIN", nullable = false, precision = 8, scale = 1)
	public Float getSellMin() {
		return this.sellMin;
	}

	public void setSellMin(Float sellMin) {
		this.sellMin = sellMin;
	}

	@Column(name = "SELL_EXT", nullable = false, precision = 8, scale = 1)
	public Float getSellExt() {
		return this.sellExt;
	}

	public void setSellExt(Float sellExt) {
		this.sellExt = sellExt;
	}

	@Column(name = "SELL_UNIT", length = 30)
	public String getSellUnit() {
		return this.sellUnit;
	}

	public void setSellUnit(String sellUnit) {
		this.sellUnit = sellUnit;
	}

	@Column(name = "UNIT_CONVERT", precision = 8, scale = 1)
	public Float getUnitConvert() {
		return this.unitConvert;
	}

	public void setUnitConvert(Float unitConvert) {
		this.unitConvert = unitConvert;
	}

	@Column(name = "PIC", length = 100)
	public String getPic() {
		return this.pic;
	}

	public void setPic(String pic) {
		this.pic = pic;
	}

	@Column(name = "DESCR_TEXT", length = 2000)
	public String getDescrText() {
		return this.descrText;
	}

	public void setDescrText(String descrText) {
		this.descrText = descrText;
	}

	@Column(name = "DESCR_DEF", length = 4000)
	public String getDescrDef() {
		return this.descrDef;
	}

	public void setDescrDef(String descrDef) {
		this.descrDef = descrDef;
	}

	@Column(name = "ADD_TIME", nullable = false, precision = 15, scale = 0)
	public Long getAddTime() {
		return this.addTime;
	}

	public void setAddTime(Long addTime) {
		this.addTime = addTime;
	}

	@Column(name = "SUB_TITLE", length = 250)
	public String getSubTitle() {
		return this.subTitle;
	}

	public void setSubTitle(String subTitle) {
		this.subTitle = subTitle;
	}

	@Column(name = "CATEGORY_PATH", nullable = false, length = 100)
	public String getCategoryPath() {
		return this.categoryPath;
	}

	public void setCategoryPath(String categoryPath) {
		this.categoryPath = categoryPath;
	}

	@Column(name = "STANDARD", length = 100)
	public String getStandard() {
		return this.standard;
	}

	public void setStandard(String standard) {
		this.standard = standard;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "goods")
	public Set<SpecType> getSpecTypes() {
		return this.specTypes;
	}

	public void setSpecTypes(Set<SpecType> specTypes) {
		this.specTypes = specTypes;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "goods")
	public Set<StoreGoods> getStoreGoodses() {
		return this.storeGoodses;
	}

	public void setStoreGoodses(Set<StoreGoods> storeGoodses) {
		this.storeGoodses = storeGoodses;
	}

}